/**
 * ReportGear(2011)
 */
package net.abbp.report.designer.applet;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.JApplet;
import javax.swing.UIManager;

import net.abbp.report.designer.components.resume.PrintPane;
import net.abbp.swing.util.GuiUtils;
import netscape.javascript.JSObject;

import com.jidesoft.utils.Lm;
import com.reportgear.report.setting.AppletSettings;
import com.reportgear.report.setting.ApplicationContext;

/**
 * 简历打印Applet
 * 
 * @version 1.0 2011-4-16
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 */
public class ResumePrintApplet extends JApplet {
    private static final long serialVersionUID = 1185196357206700525L;

    static {
        Lm.verifyLicense("Digital China", "BriskBVM", "eJYwQanZJAjb5eac7o2Pe1WeZ1htbGP1");
    }

    PrintPane pane;

    public void init() {
        super.init();
    }

    public void start() {
    }

    public void stop() {
    }

    public void destroy() {
    }

    private void initComponents() {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (Exception e) {
            e.printStackTrace();
        }

        GuiUtils.setDefaultUIFont("宋体");

        this.setLayout(new BorderLayout());
        this.setBackground(Color.WHITE);

        pane = new PrintPane();
        this.add(pane);
    }

    /**
     * 打印履历表
     * 
     * @param resumeInfo
     *            履历信息，人员ID和名称信息 id，名称;id,名称
     */
    public void printResume(String resumeInfo) {
        ApplicationContext.INSTANCE.setApplet(true);
        AppletSettings appletSettings = AppletSettings.INSTANCE;

        appletSettings.setJsObject(JSObject.getWindow(this));

        initComponents();

        pane.setResumeInfo(resumeInfo);
        
        this.getRootPane().updateUI();
    }
}
